<div class="row animate fadeIn">

  <!-- Approval Form -->
    <form class="form-horizontal" id="trans_inv_form">
    <div class="ibox-title" style="border:none;"><h5 style="color: #00afef"><i>Approve Request</i></h5>
     </div>
     <div class="ibox-content">
        <?php foreach ($datas as $data) { ?>
            <div class="form-group">
                <label class="col-lg-3 control-label">Request Number:</label>
                <div class="col-lg-5">
                    <input type="text" id=""class="form-control" name="" value="<?php echo $data->inv_request_num; ?>"  readonly>
                </div>
             </div>
             <div class="form-group">
                <label class="col-lg-3 control-label">Request Date:</label>
                 <div class="col-lg-5">
                    <input type="date" id="" class="form-control" name="" value="<?php echo $data->inv_request_date; ?>"  readonly>
                </div>
            </div>
            <div class="form-group">
                <label class="col-lg-3 control-label">Requested By:</label>
                 <div class="col-lg-5">
                    <input type="text" id="" class="form-control" name="" value="<?php echo $data->user_name.' ('.$data->last_name.', '.$data->first_name.')'; ?>"  readonly>
                </div>
            </div>
            <!-- <div class="form-group">
                <label class="col-lg-3 control-label">Approved By:</label>
                <div class="col-lg-5">
                    <input type="text" id=""class="form-control" name="" value="<?php ?>"  readonly>
                </div>
            </div> -->
            <div class="form-group">
                <label class="col-lg-3 control-label">Status:</label>
                <div class="col-lg-5">
                   <select class = "chosen-select" name="apprv_stat" id ="aprv_s" disabled>
                      <?php foreach ($status as $stat) {  
                        if(!($stat->lookup_code == 'REQ_SUBMITTED' || $stat->lookup_code == 'REQ_RELEASED' )) {?>
                        <option value="<?php echo $stat->lookup_code; ?>" id="" <?php echo ($stat->lookup_code == $data->inv_request_status ? 'selected' : ''); ?> ><?php echo $stat->meaning; ?></option>
                      <?php } } ?>
                    </select>
                </div>
            </div>
        <?php } ?>    
      </div>
    </form>


    <div id="list_sequence">
        <div id="" class="ibox-content">
          <h3 style="color: #00afef">Requested Item</h3>
                <input type="hidden" id="" name="c_reqId_ed" value="<?php echo $req_id; ?>">
                    <table id="pgTable"class="table table-bordered" style="width:80%;">
                      <thead>
                        <tr>
                          <th style="width:100px;">Sequence</th>
                          <th>Item</th>
                          <th style="width:100px;">Qty</th>
                        </tr>
                      </thead>

                      <tbody id="tbody_viewCon" class="animate fadeIn">
                                                        
                      </tbody>
                    </table> 
        </div>
      </div>
 
    
 </div>
 <script>
    $(document).ready(function(){
    $(".chosen-select").chosen({width:"100%;"}); 
    var req_id    = <?php echo json_encode($req_id);    ?>;
    generate_reqContents(req_id);


    function generate_reqContents(id){
      $.ajax({
            type: "POST",
            url: "<?php echo base_url($this->session->userdata('forajax').'/view_req_contents'); ?>"+"/"+id,
            dataType: 'json',
        success: function(data){
              $('#tbody_viewCon').empty();
              var trHTML = '';
                $.each(data, function(i, item) {
                  trHTML += '<tr><input id="reqcon_id" type="hidden" value="'+ data[i].req_content_id +'"><td>' + data[i].sequence_num + '</td><td text-align:right;>' + data[i].item_num + ' ('+data[i].description+')' + '</td><td text-align:right;>' + data[i].inv_item_qty + '</td></tr>';               
                });

                  $('#tbody_viewCon').append(trHTML);
                }      
            });
    }

      $('#viewX').click(function(){
                    close_view();
               });
    });
 </script>  